#ifndef KMEM_H
#define	KMEM_H

#include <exec/macros.h>



// The base and top virtual addresses covered by the kernel allocator
#define KMEM_VMM_BASE	0x4000					// 16kB
#define KMEM_VMM_TOP	PAGING_MIRROR_VADDR		// 1GB - 4MB


// 
// Flags for kmem_vmm_new_range and kmem_vmm_alloc
// 
#define KMEM_VMM_MAP		(1<<0)				// Physical pages should be immediately mapped
#define KMEM_VMM_ATOMIC		(1<<1)				// Allocation should either success or fail, without blocking


struct kmem_range;





// 
// Allocate an object from the given cache.
// 
// @param alloc_flags An or-ed combination of the SOS_KSLAB_ALLOC_* flags
// 
vir_addr kmem_cache_alloc(slab_cache *slab_cache, ULONG alloc_flags);


// 
// Free an object (assumed to be already allocated and not already
// free) at the given virtual address.
// 
LONG kmem_cache_free(vir_addr vaddr);


#endif